<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@include file="/context/mytags.jsp"%>
<t:base type="jquery,easyui,tools,DatePicker"></t:base>

<div class="easyui-layout" fit="true">
  <div region="center" style="padding:1px;">
  <t:datagrid name="processingReportList_${itype}" title="工序汇报" actionUrl="processingReportController.do?datagrid" queryParams="{itype:'${itype }'}" idField="id" fit="true" queryMode="group">
   <t:dgCol title="本厂批号" field="fbcph" query="true" ></t:dgCol>
   <t:dgCol title="当前工序" field="cprocess"  dictionary="ccgx"  query="true" ></t:dgCol>
   <t:dgCol title="投入宽度" field="ftrkd" ></t:dgCol>
   <t:dgCol title="投入厚度" field="ftrhd" ></t:dgCol>
   <t:dgCol title="投入重量" field="ftrzl" ></t:dgCol>
   <t:dgCol title="制单时间" field="create_date" ></t:dgCol>
   <t:dgCol title="状态" field="fstate" dictionary="hbstate" style="setColor()" ></t:dgCol>
   
   <t:dgToolBar title="工序汇报" icon="icon-edit" url="processReportController.do?addorupdate" funname="update_check"></t:dgToolBar>
   <t:dgToolBar title="查看" icon="icon-search" url="processReportController.do?addorupdate" funname="detail"></t:dgToolBar>
  </t:datagrid>
  </div>
</div>
 
 
 <script>
 	function setColor(value,rec,index){
 		
 		if(value==0){
 			return "color:red;";
 		}
 		if(value==1){
 			return "color:green;";
 		}
 		return "";
 	}
 	
 	
 	function update_check(title,url, id,width,height) {
 	    
 	   
 		var rowsData = $('#'+id).datagrid('getSelections');
		if (!rowsData || rowsData.length==0) {
			tip('请选择编辑项目');
			return;
		}
		if (rowsData.length>1) {
			tip('请选择一条记录再编辑');
			return;
		}
		
		var fstate=rowsData[0].fstate;
		if(fstate!="0" && fstate!="1"){
			tip('该记录已汇报');
			return;
		}
		update(title,url, id,width,height);
	}

 </script>